package wellplatescanner;
import java.util.ArrayList;
import java.util.List;


public class Log {
	
	public static interface LogListener {
		void logAdded(String s);
	}

	private static List<LogListener> listeners = new ArrayList<LogListener>();
	
	public static void addLogListener(LogListener logListener) {
		if(!listeners.contains(logListener)) {
			listeners.add(logListener);
		}
	}

	public static void removeLogListener(LogListener listener) {
		listeners.remove(listener);
	}

	public static void println(String s) {
		
		System.out.println(s);
		
		String out = s + "\n";
		
		for(LogListener listener : listeners) {
			listener.logAdded(out);
		}
	}
}
